package school.valon.persistence.pojo;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the course_offering_student_enrolment database table.
 * 
 */
@Embeddable
public class CourseOfferingStudentEnrolmentPK implements Serializable {
	private static final long serialVersionUID = 1239093162341336510L;

	@Column(name="user_id", insertable=false, updatable=false)
	private Integer studentId;

	@Column(name="course_offering_id", insertable=false, updatable=false)
	private Integer courseOfferingId;

	public CourseOfferingStudentEnrolmentPK() {
	}
	public Integer getStudentId() {
		return this.studentId;
	}
	public void setStudentId(Integer studentId) {
		this.studentId = studentId;
	}
	public Integer getCourseOfferingId() {
		return this.courseOfferingId;
	}
	public void setCourseOfferingId(Integer courseOfferingId) {
		this.courseOfferingId = courseOfferingId;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof CourseOfferingStudentEnrolmentPK)) {
			return false;
		}
		CourseOfferingStudentEnrolmentPK castOther = (CourseOfferingStudentEnrolmentPK)other;
		return 
			(this.studentId == castOther.studentId)
			&& (this.courseOfferingId == castOther.courseOfferingId)
			&& (this.studentId != null && this.studentId.equals(castOther.studentId))
			&& (this.courseOfferingId != null && this.courseOfferingId.equals(castOther.courseOfferingId));
	}

	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + (this.studentId == null ? 0 : this.studentId);
		hash = hash * prime + (this.courseOfferingId == null ? 0 : this.courseOfferingId);
		
		return hash;
	}
}